/******************************************************************************
*
* This file is part of FreeTrack (http://code.google.com/p/qtfreetrack).
* BY Willy Gardiol (willy@gardiol.org)
*
* FreeTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FreeTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar.  If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
#include "layertracklabel.h"

LayerTrackLabel::LayerTrackLabel(QColor color, int size) :
    FreeTrackWidget(0)
{
    color_label = new FTLabel("");
    color_label->setMinimumWidth( 48 );
    color_label->setMinimumHeight( 32 );
    size_label = new FTLabel("");
    sizeUpdated(size);
    colorUpdated(color);
    }

void LayerTrackLabel::colorUpdated(QColor color)
{
    color_label->setBackground( QBrush( color, Qt::SolidPattern ));
}

void LayerTrackLabel::sizeUpdated(int size)
{
    size_label->setText( QString("%1: %2px").arg(tr("Size")).arg(size));
}

QLayout* LayerTrackLabel::createHorizontal()
{
    return createVertical();
}

QLayout* LayerTrackLabel::createVertical()
{
    QHBoxLayout* grid = new QHBoxLayout();
    grid->addStretch();
    grid->addWidget( size_label );
    grid->addStretch();
    grid->addWidget( color_label );
    grid->addStretch();
    return grid;
}
